<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button class="btn">点击查询信息是否正确</button>
    <script>
        var btn=document.getElementsByClassName("btn")[0];
        var a=false;
        var age=20;
        btn.onclick=function(){
            a=!a;
            console.log(`你的名字是${a? '张三': '李四'}你的年龄是${age+1}`)
        }
    </script>
</body>
</html>